package com.skyworth.web.admin.company.repository;

import com.skyworth.web.admin.company.domain.CompanyModel;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

/**
 * Created by skyworth on 2016/11/10.
 */
public interface CompanyRepository extends PagingAndSortingRepository<CompanyModel, Long> {
	@Query("SELECT CASE WHEN COUNT(cc) > 0 THEN 'true' ELSE 'false' END FROM CompanyModel cc WHERE cc.ownerId = ?1")
	boolean existByUser(long userId);
}
